from langchain.chains.llm import LLMChain
from langchain_core.prompts import PromptTemplate
from langchain_openai import ChatOpenAI
from dotenv import load_dotenv
load_dotenv()
template = PromptTemplate(
    input_variables=["role","fruit"],
    template = "{role}喜欢吃{fruit}",
)


#创建模型实例
llm = ChatOpenAI(temperature=0)
llm_chain = LLMChain(llm=llm,prompt = template)
input_list = [
    {"role": "猪八戒", "fruit":"人参果"}, {"role":"孙悟空", "fruit":"仙桃"}
]
result = llm_chain.batch(input_list)
print(result)
